package com.sddfp.client.access;

import com.sddfp.client.access.fallback.TradeLogApiFallback;
import com.sddfp.common.pojo.*;
import com.sddfp.common.result.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @FeignClient
 * 1、定义feign的客户端
 * 2、value 指定服务提供者的服务实例名称
 */
@FeignClient(
        value = "sddfp-service-bank-access",
        fallback = TradeLogApiFallback.class)
public interface TradeLogApi {
    /**
     * 绑卡生成交易记录 (对外暴漏的接口，也就是给客户端调用的接口)
     * 注意：这里的方法签名、路径、请求方式必须与服务提供者一致
     */
    @PostMapping("/trade-log/bank/access/card")
    public SignatureDto proxyBindCardLog(@RequestBody BankCardAddDTO bankCardAddDTO);

    @GetMapping("/my/bank/test")
    public String showPort();

    @PostMapping("/trade-log/bank/access/sync/borrow")
    public Result<BaseResult> syncBorrowRecord(@RequestBody BorrowSyncRecordVo borrowSyncRecordVo);

    @ApiOperation("获取机构账户余额信息")
    @GetMapping("/trade-log/bank/access/bid/balance/{userCode}")
    Result<BidBalanceDTO> getBidBalance(@PathVariable("userCode") String userCode);

    @ApiOperation("银行保存投资认购记录")
    @PostMapping("/trade-log/bank/access/bid/add")
    Result<String> bankBidService(@RequestBody BankBidDTO bankBidDTO);
}
